/**
  ******************************************************************************
  * @file 扩展IO管理
  * @brief 
  * @author Moon
  * @version V1.0.0
  * @date 2022/12/12
  ******************************************************************************
  */
#ifndef _EXPEND_IO_H
#define _EXPEND_IO_H

#include <stdint.h>

/* Public defines -----------------------------------------------------------*/

/* Public Struct  -----------------------------------------------------------*/

/* Public enum    -----------------------------------------------------------*/
typedef enum
{
    TCA9535_1 = 0,
    TCA9535_2 = 1,
	
    TCA9535_NUM,
} TCA9535_TYPE;

typedef enum
{
    FAN1_CON =          0x0001,         //风扇控制
    FAN2_CON =          0x0002,         
    FAN3_CON =          0x0004,         
    FAN4_CON =          0x0008,         
    FAN5_CON =          0x0010,         
    FAN6_CON =          0x0020,         
    FAN7_CON =          0x0040,         
    FAN8_CON =          0x0080,         

    FAN1_RD =           0x0100,         //风扇状态读取
    FAN2_RD =           0x0200,
    FAN3_RD =           0x0400,
    FAN4_RD =           0x0800,
    FAN5_RD =           0x1000,
    FAN6_RD =           0x2000,
    FAN7_RD =           0x4000,
    FAN8_RD =           0x8000,
}expandio_1_pin_e;

typedef enum
{
    SWCON1 =            0x0001,         //SWCON1、3、5、7为定量管控制 ，SWCON2、4、6、8为样品管控制
    SWCON2 =            0x0002,         
    SWCON3 =            0x0004,         
    SWCON4 =            0x0008,         
    SWCON5 =            0x0010,         
    SWCON6 =            0x0020,         
    SWCON7 =            0x0040,         
    SWCON8 =            0x0080,         

    SWCON9 =            0x0100,         //氮气总开关
    SWCON10 =           0x0200,         //氦气总开关
    HEAT_CON1 =         0x0400,         //加热丝控制
    HEAT_CON2 =         0x0800,
    HEAT_CON3 =         0x1000,
    HEAT_CON4 =         0x2000,
    FAN9_RD =           0x4000,
    FAN9_CON =          0x8000,
}expandio_2_pin_e;

typedef enum
{
    TCD_CCS_SEL1 =      0x0001,			//TCD开关
    TCD_CCS_SEL2 =      0x0002,
    TCD_CCS_SEL3 =      0x0004,
    TCD_CCS_SEL4 =      0x0008,
    AIN_G_31_SET1 =     0x0010,
    AIN_G_31_SET2 =     0x0020,
    AIN_G_31_SET3 =     0x0040,
    AIN_G_31_SET4 =     0x0080,

}expandio_3_pin_e;

typedef enum
{
    MOTOR_A1 =          0x0001,
    MOTOR_B1 =          0x0002,
    MOTOR_A2 =          0x0004,
    MOTOR_B2 =          0x0008,
    MOTOR_A3 =          0x0010,
    MOTOR_B3 =          0x0020,
    MOTOR_A4 =          0x0040,
    MOTOR_B4 =          0x0080,

    LIM_IO1 =           0x0100,
    LIM_IO2 =           0x0200,
    LIM_IO3 =           0x0400,
    LIM_IO4 =           0x0800,
    LIM_IO5 =           0x1000,
    LIM_IO6 =           0x2000,
    LIM_IO7 =           0x4000,
    LIM_IO8 =           0x8000,
}expandio_4_pin_e;

#if 0
typedef enum
{
    LED_B1 =            0x0001,
    LED_R1 =            0x0002,
    LED_G1 =            0x0004,
    LED_B2 =            0x0008,
    LED_R2 =            0x0010,
    LED_G2 =            0x0020,
    LED_B3 =            0x0040,
    LED_R3 =            0x0080,

    LED_G3 =            0x0100,
    LED_B4 =            0x0200,
    LED_R4 =            0x0400,
    LED_G4 =            0x0800,
    SWCON11=            0x1000,
}expandio_5_pin_e;
#endif

typedef enum
{
	LED_B1 =            1<<0,
	LED_R1 =            1<<1,
	LED_G1 =            1<<2,
	LED_Y1 =						LED_R1|LED_G1,
	LED_B2 =            1<<3,
	LED_R2 =            1<<4,
	LED_G2 =            1<<5,
	LED_Y2 =						LED_R2|LED_G2,
	LED_B3 =            1<<6,
	LED_R3 =            1<<7,
	LED_G3 =            1<<8,
	LED_Y3 =						LED_R3|LED_G3,
}expandio_led_pin_e;

typedef enum
{
	BLUE = 0,
    RED,
    GREEN,
    YELLOW,
}led_color_e;

typedef enum
{
	S1 = 0,
    S2,
    S3,
}led_tube_pos_e;

typedef enum 
{
	EXPAND_IO_CLOSE = 0,	    //IO关
	EXPAND_IO_OPEN,		        //IO开
} expand_io_status_e;
/* Public Variable  ---------------------------------------------------------*/
//Pointer

//Array

//Const

/* Pubilc function prototypes -----------------------------------------------*/
void Expand_IO_SetState(TCA9535_TYPE type, expand_io_status_e state,uint16_t dev);
uint16_t Expand_IO_GetState(TCA9535_TYPE type);
void Expand_IO_Mode_Init(void);
int Expand_IO_Init(void);
#endif /* _EXPEND_IO_H */

/******************* (C) COPYRIGHT 2022 CIQTEK helei *****END OF FILE****/
